import React, { useState } from 'react';
import './index.less';
import { Divider, Button } from 'antd-mobile';
import { RightOutline } from 'antd-mobile-icons';
export default function Ticket(props: {
  _id: any;
  good: any;
  price: Number;
  type: String;
  done: Boolean;
  desc: String;
  num: Number;
  setDone: any;
}) {
  function updone(id) {
    console.log(id, '子组件传递');
    props.setDone(id);
  }
  return (
    <div className="ticket">
      {props.type == '无门槛' ? <p>无门槛</p> : <p>满{props.type}可用</p>}
      <span className="p2">
        <p className="p3">
          ￥<span>{props.price}</span>
        </p>
        {props.good.name.slice(0, 5)}可用
      </span>
      <Divider />
      <Button
        color="danger"
        size="mini"
        className={props.done ? 'btn1' : 'btn'}
        onClick={() => {
          updone(props._id);
        }}
      >
        {props.done ? '已领取' : '立即领取'}
      </Button>
    </div>
  );
}
